// 调用后端接口地址
import { API_CONFIG } from "../config/index.js";
import request from '../api/index.js'


export const addClusterHandler = (data) => {
    console.log("添加集群:",data)
    return request(API_CONFIG.addClusterApi, data, "post", 2000)
}

export const updateClusterHandler = (data) => {
    console.log("更新集群:",data)
    return request(API_CONFIG.updateClusterApi, data, "post", 2000)
}

export const deleteClusterHandler = (clusterId) => {
    console.log("删除集群::", clusterId)
    return request(API_CONFIG.deleteClusterApi, {clusterId}, "get", 3000)
}

export const getClusterHandler = (clusterId) => {
    return request(API_CONFIG.getClusterApi, {clusterId}, "get", 2000)
}

export const listClusterHandler = () => {
    return request(API_CONFIG.listClusterApi, {}, "get", 2000)
}

// 节点操作
export const listNodeHandler = (clusterId) => {
    return request(API_CONFIG.listNodeApi, {clusterId}, "get", 2000)
}

// 集群统计信息
export const getClusterStatisticsHandler = () => {
    return request(API_CONFIG.statisticsClusterApi, {}, "get", 5000)
}
// 集群统计信息
export const getClusterDetailHandler = (clusterId) => {
    console.log("查询资源详情统计")
    return request(API_CONFIG.detailClusterApi, {clusterId}, "get", 2000)
}

